<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.thymeleaf.org" layout:decorator="layouts/editableLayout">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div layout:fragment="bodyContent">
    <form id="createCateForm" method="post" enctype="multipart/form-data" action="/cate/create">
        <input type="hidden" id="cate_id" th:value="${cate.id}"/>
        <div class="form-group">
            <label for="new_cate_name">Name:</label>
            <input type="text" name="name" class="form-control" th:value="${cate.name}" id="new_cate_name"/>
        </div>
        <div class="form-group">
            <label for="new_cate_shortcut">Shortcut:</label>
            <input type="text" name="shortcut" class="form-control" id="new_cate_shortcut" th:value="${cate.shortcut}"/>
        </div>
        <div class="form-group">
            <label for="new_cate_price">Price:</label>
            <input type="number" name="price" class="form-control" id="new_cate_price" th:value="${cate.price}"/>
        </div>
        <div class="form-group">
            <label for="new_cate_vip_price">Vip price:</label>
            <input type="number" name="vipPrice" class="form-control" id="new_cate_vip_price" th:value="${cate.vipPrice}"/>
        </div>
        <div class="form-group" id="categoryGroup" th:attr="data-pid=${category_pid},data-id=${category_id}">

        </div>
        <div class="form-group">
            <input type="hidden" id="cate_desc_value" th:value="${cate.description}"/>
            <div  id="new_cate_description"></div>

        </div>

        <div class="form-group">
            <input type="button" onclick="saveOrUpdateCate(2)" class="btn btn-success btn-block" value="Update"/>
        </div>

    </form>
    <script src="/js/hzy-1.0/hzy-category.js"></script>
    <script src="/js/hzy-1.0/hzy-cate.js"></script>
    <script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
    <script>
        var quill = new Quill('#new_cate_description', {
          modules: { toolbar: toolbarOptions },
          theme: 'snow'
        });
        quill.pasteHTML($("#cate_desc_value").val());

        $(document).ready(function(){
            var cateId = $("#cate_id").val();
            $("#categoryGroup").loadCategory({'cate_id':cateId});
        });

      </script>
</div>

</body>
</html>